package com.czl.module_storehouse.mvp.presenter;

import com.czl.module_base.bean.ListBean;
import com.czl.module_base.http.HttpResponse;
import com.czl.module_base.mvp.presenter.BasePresenter;
import com.czl.module_base.mvp.view.SimpleView;
import com.czl.module_base.observer.AbsHandleSubscriber;
import com.czl.module_storehouse.bean.StorageRecordBean;
import com.czl.module_storehouse.mvp.model.WarehouseRecordModel;

/**
 * @author by xubin,
 * @date on 2022/3/3.
 * PS: Not easy to write code, please indicate.
 */
public class WarehouseRecordPresenter extends BasePresenter<WarehouseRecordModel, SimpleView> {

    public void getStorageList(boolean refresh) {
        resetPageNo(refresh);
        doSubscribe(mModel.getStorageList(mPageNo), new AbsHandleSubscriber<HttpResponse<ListBean<StorageRecordBean>>>() {
            @Override
            public void onSuccess(HttpResponse<ListBean<StorageRecordBean>> httpResponse) {
                mView.showData(httpResponse.getData());
                nextPageNo();
            }
        });
    }
}
